0

Untitled7.ipynb

No Headings

The table of contents shows headings in notebooks and supported files.

Skip to Main
Jupyter

Untitled7

Last Checkpoint: 5 seconds ago
  • File
  • Edit
  • View
  • Run
  • Kernel
  • Settings
  • Help
JupyterLab
Python [conda env:base] *
Kernel status: Idle Executed 2 cellsElapsed time: 240 seconds
image/svg+xml
  1. 1
  2. 2
  3. 3
[4]:
!pip install pandas numpy scikit-learn matplotlib seaborn

Requirement already satisfied: pandas in c:\users\manju teppala\.ms-ad\lib\site-packages (2.2.2)
Requirement already satisfied: numpy in c:\users\manju teppala\.ms-ad\lib\site-packages (1.26.4)
Requirement already satisfied: scikit-learn in c:\users\manju teppala\.ms-ad\lib\site-packages (1.5.1)
Requirement already satisfied: matplotlib in c:\users\manju teppala\.ms-ad\lib\site-packages (3.9.2)
Requirement already satisfied: seaborn in c:\users\manju teppala\.ms-ad\lib\site-packages (0.13.2)
Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\manju teppala\.ms-ad\lib\site-packages (from pandas) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in c:\users\manju teppala\.ms-ad\lib\site-packages (from pandas) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in c:\users\manju teppala\.ms-ad\lib\site-packages (from pandas) (2023.3)
Requirement already satisfied: scipy>=1.6.0 in c:\users\manju teppala\.ms-ad\lib\site-packages (from scikit-learn) (1.13.1)
Requirement already satisfied: joblib>=1.2.0 in c:\users\manju teppala\.ms-ad\lib\site-packages (from scikit-learn) (1.4.2)
Requirement already satisfied: threadpoolctl>=3.1.0 in c:\users\manju teppala\.ms-ad\lib\site-packages (from scikit-learn) (3.5.0)
Requirement already satisfied: contourpy>=1.0.1 in c:\users\manju teppala\.ms-ad\lib\site-packages (from matplotlib) (1.2.0)
Requirement already satisfied: cycler>=0.10 in c:\users\manju teppala\.ms-ad\lib\site-packages (from matplotlib) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\manju teppala\.ms-ad\lib\site-packages (from matplotlib) (4.51.0)
Requirement already satisfied: kiwisolver>=1.3.1 in c:\users\manju teppala\.ms-ad\lib\site-packages (from matplotlib) (1.4.4)
Requirement already satisfied: packaging>=20.0 in c:\users\manju teppala\.ms-ad\lib\site-packages (from matplotlib) (24.1)
Requirement already satisfied: pillow>=8 in c:\users\manju teppala\.ms-ad\lib\site-packages (from matplotlib) (10.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in c:\users\manju teppala\.ms-ad\lib\site-packages (from matplotlib) (3.1.2)
Requirement already satisfied: six>=1.5 in c:\users\manju teppala\.ms-ad\lib\site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)
[10]:
Selection deleted
import matplotlib.pyplot as plt

students = {}

def safe_int(prompt, default=None):
while True:
try:
return int(input(prompt).strip())
except ValueError:
print("Please enter a valid integer.")

def safe_float(prompt):
while True:
try:
return float(input(prompt).strip())
except ValueError:
print("Please enter a valid number (e.g. 78 or 78.5).")

num_students = safe_int("How many students? ")

for s in range(num_students):
name = input(f"\nEnter name of student {s+1}: ").strip() or f"Student_{s+1}"
num_subs = safe_int(f"How many subjects for {name}? ")
marks_dict = {}
if num_subs == 0:
print("Warning: zero subjects — student will have empty marks.")
for i in range(num_subs):
subj = input(f" Enter subject {i+1}: ").strip() or f"Subject_{i+1}"
mark = safe_float(f" Enter marks in {subj}: ")
marks_dict[subj] = mark
students[name] = marks_dict

print("\nStudents Data:")
print(students)

def analyze_marks(marks):
if not marks:
return 0, 0.0, (None, None), (None, None)
total = sum(marks.values())
avg = total / len(marks)
high_sub = max(marks, key=marks.get)
low_sub = min(marks, key=marks.get)
return total, avg, (high_sub, marks[high_sub]), (low_sub, marks[low_sub])

print("\n--- Student Marks Report ---")
for name, marks in students.items():
total, avg, high, low = analyze_marks(marks)
print(f"\nStudent: {name}")
print(f"Subjects & Marks: {marks}")
print(f"Total Marks: {total}")
print(f"Average Marks: {avg:.2f}")
if high[0] is not None:
print(f"Highest: {high[1]} in {high[0]}")
print(f"Lowest : {low[1]} in {low[0]}")
else:
print("No subject marks available.")

if students:
name = input("\nEnter student name to plot marks (or press Enter to skip): ").strip()
if name:
if name in students and students[name]:
marks = students[name]
plt.bar(marks.keys(), marks.values())
plt.title(f"{name} - Marks Chart")
plt.xlabel("Subjects")
plt.ylabel("Marks")
plt.ylim(0, max(marks.values()) + 10)
plt.show()
elif name in students:
print("Student has no marks to plot.")
else:
print("Student not found!")
else:
print("No students available to plot.")

How many students?  3

Enter name of student 1:  Veena
How many subjects for Veena?  3
  Enter subject 1:  Maths
  Enter marks in Maths:  93
  Enter subject 2:  Science
  Enter marks in Science:  98
  Enter subject 3:  Hindi
  Enter marks in Hindi:  94

Enter name of student 2:  Rani
How many subjects for Rani?  3
  Enter subject 1:  Maths
  Enter marks in Maths:  90
  Enter subject 2:  Science
  Enter marks in Science:  97
  Enter subject 3:  Hindi
  Enter marks in Hindi:  91

Enter name of student 3:  Vani
How many subjects for Vani?  3
  Enter subject 1:  Maths
  Enter marks in Maths:  96
  Enter subject 2:  Science
  Enter marks in Science:  93
  Enter subject 3:  Hindi
  Enter marks in Hindi:  99
Students Data:
{'Veena': {'Maths': 93.0, 'Science': 98.0, 'Hindi': 94.0}, 'Rani': {'Maths': 90.0, 'Science': 97.0, 'Hindi': 91.0}, 'Vani': {'Maths': 96.0, 'Science': 93.0, 'Hindi': 99.0}}

--- Student Marks Report ---

Student: Veena
Subjects & Marks: {'Maths': 93.0, 'Science': 98.0, 'Hindi': 94.0}
Total Marks: 285.0
Average Marks: 95.00
Highest: 98.0 in Science
Lowest : 93.0 in Maths

Student: Rani
Subjects & Marks: {'Maths': 90.0, 'Science': 97.0, 'Hindi': 91.0}
Total Marks: 278.0
Average Marks: 92.67
Highest: 97.0 in Science
Lowest : 90.0 in Maths

Student: Vani
Subjects & Marks: {'Maths': 96.0, 'Science': 93.0, 'Hindi': 99.0}
Total Marks: 288.0
Average Marks: 96.00
Highest: 99.0 in Hindi
Lowest : 93.0 in Science
Enter student name to plot marks (or press Enter to skip):  Rani
[ ]:

Common Tools
No metadata.
Advanced Tools
No metadata.
Anaconda Assistant
AI-powered coding, insights and debugging in your notebooks.
To enable the following extensions, create an account or sign in.
  • Anaconda Assistant
    4.1.0
  • Coming soon!
  • Data Catalogs
  • Panel Deployments
  • Sharing
Already have an account? Sign In
For more information, read our Anaconda Assistant documentation.
Alt+[
Alt+]
Alt+End
  • Assistant
  • Open Anaconda Assistant
    Ctrl+Shift+A
  • Console
  • Change Kernel…
  • Clear Console Cells
  • Close and Shut Down…
  • Insert Line Break
  • Interrupt Kernel
  • New Console
  • Restart Kernel…
  • Run Cell (forced)
  • Run Cell (unforced)
  • Show All Kernel Activity
  • Display Languages
  • English
    English
  • File Operations
  • Autosave Documents
  • Download
    Download the file to your computer
  • Reload Notebook from Disk
    Reload contents from disk
  • Revert Notebook to Checkpoint…
    Revert contents to previous checkpoint
  • Save Notebook
    Save and create checkpoint
    Ctrl+S
  • Save Notebook As…
    Save with new path
    Ctrl+Shift+S
  • Trust HTML File
    Whether the HTML file is trusted. Trusting the file allows scripts to run in it, which may result in security risks. Only enable for files you trust.
  • Help
  • About Jupyter Notebook
  • Jupyter Reference
  • JupyterLab FAQ
  • JupyterLab Reference
  • Launch Jupyter Notebook File Browser
  • Markdown Reference
  • Show Keyboard Shortcuts…
    Show relevant keyboard shortcuts for the current active widget
    Ctrl+Shift+H
  • Image Viewer
  • Flip image horizontally
    H
  • Flip image vertically
    V
  • Invert Colors
    I
  • Reset Image
    0
  • Rotate Clockwise
    ]
  • Rotate Counterclockwise
    [
  • Zoom In
    =
  • Zoom Out
    -
  • Kernel Operations
  • Shut Down All Kernels…
  • Main Area
  • Close All Other Tabs
  • Close Tab
    Alt+W
  • Close Tabs to Right
  • End Search
    Esc
  • Find Next
    Ctrl+G
  • Find Previous
    Ctrl+Shift+G
  • Find…
    Ctrl+F
  • Log Out
    Log out of Jupyter Notebook
  • Search in Selection
    Alt+L
  • Shut Down
    Shut down Jupyter Notebook
  • Mode
  • Toggle Zen Mode
  • Notebook Cell Operations
  • Change to Code Cell Type
    Y
  • Change to Heading 1
    1
  • Change to Heading 2
    2
  • Change to Heading 3
    3
  • Change to Heading 4
    4
  • Change to Heading 5
    5
  • Change to Heading 6
    6
  • Change to Markdown Cell Type
    M
  • Change to Raw Cell Type
    R
  • Clear Cell Output
    Clear outputs for the selected cells
  • Collapse All Code
  • Collapse All Outputs
  • Collapse Selected Code
  • Collapse Selected Outputs
  • Copy Cell
    Copy this cell
    C
  • Cut Cell
    Cut this cell
    X
  • Delete Cell
    Delete this cell
    D, D
  • Disable Scrolling for Outputs
  • Enable Scrolling for Outputs
  • Expand All Code
  • Expand All Outputs
  • Expand Selected Code
  • Expand Selected Outputs
  • Extend Selection Above
    Shift+K
  • Extend Selection Below
    Shift+J
  • Extend Selection to Bottom
    Shift+End
  • Extend Selection to Top
    Shift+Home
  • Insert Cell Above
    Insert a cell above
    A
  • Insert Cell Below
    Insert a cell below
    B
  • Insert Heading Above Current Heading
    Shift+A
  • Insert Heading Below Current Heading
    Shift+B
  • Merge Cell Above
    Ctrl+Backspace
  • Merge Cell Below
    Ctrl+Shift+M
  • Merge Selected Cells
    Shift+M
  • Move Cell Down
    Move this cell down
    Ctrl+Shift+Down
  • Move Cell Up
    Move this cell up
    Ctrl+Shift+Up
  • Paste Cell Above
    Paste this cell from the clipboard
  • Paste Cell and Replace
  • Paste Cell Below
    Paste this cell from the clipboard
    V
  • Redo Cell Operation
    Shift+Z
  • Render Side-by-Side
    Shift+R
  • Run Selected Cell
    Run this cell and advance
    Shift+Enter
  • Run Selected Cell and Do not Advance
    Ctrl+Enter
  • Run Selected Cell and Insert Below
    Alt+Enter
  • Run Selected Text or Current Line in Console
  • Select Cell Above
    K
  • Select Cell Below
    J
  • Select Heading Above or Collapse Heading
    Left
  • Select Heading Below or Expand Heading
    Right
  • Set side-by-side ratio
  • Split Cell
    Ctrl+Shift+-
  • Undo Cell Operation
    Z
  • Notebook Operations
  • Access Next Kernel History Entry
    Alt+Down
  • Access Previous Kernel History Entry
    Alt+Up
  • Change Kernel…
  • Clear Outputs of All Cells
    Clear all outputs of all cells
  • Close and Shut Down Notebook…
  • Collapse All Headings
    Ctrl+Shift+Left
  • Deselect All Cells
  • Edit Notebook Metadata
  • Enter Command Mode
    Ctrl+M
  • Enter Edit Mode
    Enter
  • Expand All Headings
    Ctrl+Shift+Right
  • Interrupt Kernel
    Interrupt the kernel
  • New Console for Notebook
  • New Notebook
    Create a new notebook
  • Open with Panel in New Browser Tab
  • Preview Notebook with Panel
  • Reconnect to Kernel
  • Render All Markdown Cells
  • Restart Kernel and Clear Outputs of All Cells…
    Restart the kernel and clear all outputs of all cells
  • Restart Kernel and Debug…
    Restart Kernel and Debug…
  • Restart Kernel and Run All Cells…
    Restart the kernel and run all cells
  • Restart Kernel and Run up to Selected Cell…
  • Restart Kernel…
    Restart the kernel
  • Run All Above Selected Cell
  • Run All Cells
    Run all cells
  • Run Selected Cell and All Below
  • Save and Export Notebook: Asciidoc
  • Save and Export Notebook: Executable Script
  • Save and Export Notebook: HTML
  • Save and Export Notebook: LaTeX
  • Save and Export Notebook: Markdown
  • Save and Export Notebook: PDF
  • Save and Export Notebook: Qtpdf
  • Save and Export Notebook: Qtpng
  • Save and Export Notebook: ReStructured Text
  • Save and Export Notebook: Reveal.js Slides
  • Save and Export Notebook: Webpdf
  • Select All Cells
    Ctrl+A
  • Show Line Numbers
  • Toggle Collapse Notebook Heading
  • Trust Notebook
  • Other
  • Open in JupyterLab
    JupyterLab
  • Plugin Manager
  • Advanced Plugin Manager
  • Terminal
  • Decrease Terminal Font Size
  • Increase Terminal Font Size
  • New Terminal
    Start a new terminal session
  • Refresh Terminal
    Refresh the current terminal session
  • Use Terminal Theme: Dark
    Set the terminal theme
  • Use Terminal Theme: Inherit
    Set the terminal theme
  • Use Terminal Theme: Light
    Set the terminal theme
  • Text Editor
  • Decrease Font Size
  • Increase Font Size
  • New Markdown File
    Create a new markdown file
  • New Python File
    Create a new Python file
  • New Text File
    Create a new text file
  • Spaces: 1
  • Spaces: 2
  • Spaces: 4
  • Spaces: 4
  • Spaces: 8
  • Theme
  • Decrease Code Font Size
  • Decrease Content Font Size
  • Decrease UI Font Size
  • Increase Code Font Size
  • Increase Content Font Size
  • Increase UI Font Size
  • Set Preferred Dark Theme: JupyterLab Dark
  • Set Preferred Dark Theme: JupyterLab Dark High Contrast
  • Set Preferred Dark Theme: JupyterLab Light
  • Set Preferred Light Theme: JupyterLab Dark
  • Set Preferred Light Theme: JupyterLab Dark High Contrast
  • Set Preferred Light Theme: JupyterLab Light
  • Synchronize Styling Theme with System Settings
  • Theme Scrollbars
  • Use Theme: JupyterLab Dark
  • Use Theme: JupyterLab Dark High Contrast
  • Use Theme: JupyterLab Light
  • View
  • File Browser
  • Open JupyterLab
  • Show Anaconda Assistant
    Show Show Anaconda Assistant in the right sidebar
  • Show Header
  • Show Notebook Tools
    Show Show Notebook Tools in the right sidebar
  • Show Table of Contents
    Show Show Table of Contents in the left sidebar